let vm = new Vue({
    el: '.main-content',
    data: {
        offInfo: {}
    },
    methods: {


        findById:function(id){
            console.log("拿到id:"+id);
          axios({
              url:"/guguanjia/office/get?id="+id
          }).then(resp=>{
                vm.$data.offInfo=resp.data
          })
        },
        toSelect: function (aid) {
            layer.aid = aid;
            layer.open({
                type: 2,
                title: false,
                area: ['70%', '70%'],
                content: '/sysArea/toSelect',
                end: () => {
                    if (layer.parentName != undefined && layer.parentName.length > 0) {
                        this.offInfo.parentName = layer.parentName;
                        this.offInfo.parentId = layer.aid;
                        console.log(123456)
                        console.log(this.offInfo.parentName = layer.parentName)
                    }
                }
            })
        },

        //修改
        doUpdate:function (office) {
            axios({
                url: "/guguanjia/office/updateById",
                method: "POST",
                data: office,
            }).then(response=>{
                let index = parent.layer.getFrameIndex(window.name);
                console.log(index);
                parent.layer.close(index)
            }).catch(error=>{
                layer.msg(error.message)
            })
        },

        cancel:function () {
            let index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index)
        }
    },
    created: function () {
        this.offInfo = parent.layer;
    }
});

function abcdef(id) {
   vm.findById(id)
}
